home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
emulator
/
bsvc-1.000
/
bsvc-1
/
bsvc-1.0.4
/
src
/
Framework
/
BasicDevice.hxx
< prev
next >
Wrap
Text File
|
1995-07-26
|
3KB
|
101 lines
///////////////////////////////////////////////////////////////////////////////
// $Id: BasicDevice.hxx,v 1.1 1994/02/18 19:48:13 bmott Exp $
///////////////////////////////////////////////////////////////////////////////
// BasicDevice.hxx - Device base class
//
// This is the abstract base class for all derived devices
//
//
// BSVC "A Microprocessor Simulation Framework"
// Copyright (c) 1993
// By: Bradford W. Mott
// July 26,1993
//
///////////////////////////////////////////////////////////////////////////////
// $Log: BasicDevice.hxx,v $
// Revision 1.1 1994/02/18 19:48:13 bmott
// Initial revision
//
///////////////////////////////////////////////////////////////////////////////
#ifndef BASICDEVICE_HXX
#define BASICDEVICE_HXX
#include "String.h"
#include "Event.hxx"
#include "BasicCPU.hxx"
#define AUTOVECTOR_INTERRUPT -1
#define SPURIOUS_INTERRUPT -2
class BasicCPU;
///////////////////////////////////////////////////////////////////////////////
// BasicDevice class declaration
///////////////////////////////////////////////////////////////////////////////
class BasicDevice : public EventBase {
protected:
BasicCPU* cpu; // CPU that owns the device
const char* name; // Name of the device
String initilization_arguments; // Args used to setup device
String error_message; // Startup error message
int interrupt_pending; // Interrupt pending flag
public:
BasicDevice(const char* n, char* args, BasicCPU* c)
: EventBase(&c->events),
name(n),
initilization_arguments(args),
cpu(c),
interrupt_pending(0)
{};
virtual ~BasicDevice()
{};
// Set the device's startup error message
void SetErrorMessage(const char *message)
{ error_message=message; }
// Get the device's startup error message
String GetErrorMessage()
{ return(error_message); }
// Return the name of the device
inline const char* Name()
{ return(name); }
// Return the device's CPU
inline BasicCPU* CPU()
{ return(cpu); }
// Return the initialization arguments
inline String InitializationArguments()
{ return (initilization_arguments); }
// Tells if the address maps into the device (1=Yes,0=No)
virtual char CheckMapped(unsigned long)=0;
// Return the lowest address used by the device
virtual unsigned long LowestAddress()=0;
// Return the highest address used by the device
virtual unsigned long HighestAddress()=0;
// Get a byte from the device
virtual unsigned char Peek(unsigned long)=0;
// Put a byte into the device
virtual void Poke(unsigned long,unsigned char)=0;
// Reset the device
virtual void Reset();
// This routine sends an interrupt request (IRQ) to the CPU
virtual void InterruptRequest(int level);
// This routine is called by the CPU when it processes the interrupt
virtual long InterruptAcknowledge(int level);
};
#endif